<?php
/*
homeController: Home page
Auther: Najeeb
Date: 13,Oct,2011
Last Updated on:
*/
class homeController extends appController
{
	function index()
	{
		
		$regions = $this -> home -> _getArrayData("regions", "*", "1=1 Order By regionName");
		$this -> set("regions", $regions);

		$mainCategories = $this -> home -> _getArrayData("CategoriesInfo", "*", "parentcategoryID=0 Order By categoryName");
		$this -> set("mainCategories", $mainCategories);
		
		$this -> render('GoSell.co.uk | Under Development');
	}
	
	function  makeRegionUL($regionID){
		
	 	$regionInfo = $this -> home -> _getRowData("regions", "*", "regionID=".$regionID);
		$cities = $cities = $this -> home -> _getArrayData("city", "*", "regionID=".$regionID." Order By cityName");
		$outPut="<ul>\n";
		$outPut.="<li class='heading'>".$regionInfo['regionName']."</li>\n";
		
		foreach($cities as $city)
			$outPut.="<li><a href='?page=listings&cityID=".$city['cityID']."'>".$city['cityName']."</a></li>\n";
		
		$outPut.="</ul>\n";
		return $outPut;
	}
	
	function makeCategoryUL($categoryID){
	  
	  $catInfo = $this -> home -> _getRowData("CategoriesInfo", "*", "categoryID=".$categoryID);
	  $subCats = $this -> home -> _getArrayData("CategoriesInfo", "*", "parentcategoryID=".$categoryID);
	  
	  $outPut="<ul>\n";
	  $outPut.="<li><h3>".$catInfo['categoryName']."<span> </span></h3></li>\n";
	  foreach($subCats as $subCat)
		$outPut.="<li><a href='?page=listings&catID=".$subCat['categoryID']."'>".$subCat['categoryName']."</a></li>\n";

	  $outPut.="</ul>\n";
	  return $outPut;
	}
	
}
?>
